//
//  BFRegistController.m
//  BFoodSystem
//
//  Created by 陈名正 on 2017/3/14.
//  Copyright © 2017年 陈名正. All rights reserved.
//
//注册  忘记密码共用一个

#import "BFRegistController.h"
#import "BFLoginViewController.h"
#import "BFSendCodeViewController.h"
@interface BFRegistController ()<UITextFieldDelegate>

@end

@implementation BFRegistController

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];

    [self setStatusForSubviews];
}


//布局子控件的属性值
- (void)setStatusForSubviews{

    self.nextBtn.layer.cornerRadius = 5;
    self.nextBtn.clipsToBounds = YES;
    self.nextBtn.enabled = NO;
    self.userNameTF.delegate = self;
    self.inviteTf.delegate = self;

    if ([self.selfType isEqualToString:@"changPsd"]) {
        self.inviteTf.hidden = YES;
        self.inviteLab.hidden = YES;
        self.lineView.hidden = YES;
    }
    
}

- (IBAction)nextBtnClick:(id)sender {

    if (![self.userNameTF.text isPhoneNumber]) {
        
        [BFUtils showAlertController:1 title:@"" message:@"请输入正确的手机号码"];
        return;
    }

    BFSendCodeViewController *sendVC = [[BFSendCodeViewController alloc] init];
    sendVC.nameStr = self.userNameTF.text;
    sendVC.inviteStr = self.inviteTf.text;
    sendVC.selfType = self.selfType;
    [self.navigationController pushViewController:sendVC animated:YES];
}

#pragma mark   UITextFieldDelegate
- (void)textFieldDidBeginEditing:(UITextField *)textField{
    self.nextBtn.enabled = NO;

}
- (void)textFieldDidEndEditing:(UITextField *)textField{
    
    if (self.userNameTF.text.length != 11 ) {
        self.nextBtn.enabled = NO;
        
    }else{
        self.nextBtn.enabled = YES;

    }

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}









/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
